/**
 * 环境配置
 * 根据 REACT_APP_ENV 环境变量来设置不同环境的API域名
 */

const env = process.env.REACT_APP_ENV || 'dev'

// API域名配置
const API_CONFIG = {
  dev: {
    baseURL: 'https://www.xiebaokeji.com',
    description: '开发环境',
    secretKey: 'O2rfvFdo46F6fogJhQ3xyoP9A4Fwagu4',
    nimAppKey: '09c7856ee152a6c94cde636a4c39de4a'
  },
  test: {
    baseURL: 'https://www.xiebaokeji.com',
    description: '测试环境',
    secretKey: 'O2rfvFdo46F6fogJhQ3xyoP9A4Fwagu4',
    nimAppKey: '09c7856ee152a6c94cde636a4c39de4a'
  },
  prod: {
    baseURL: 'https://www.xiebaokeji.com',
    description: '生产环境',
    secretKey: '7g4e3a1b9c2d5f8h6j3k1l2m5n8o7p6e',
    nimAppKey: '3d89c6d13e8549eacc2128743013a398'
  }
}

// 获取当前环境的API配置
export const getApiConfig = () => {
  return API_CONFIG[env as keyof typeof API_CONFIG] || API_CONFIG.dev
}

// 获取API基础URL
export const getApiBaseURL = () => {
  return getApiConfig().baseURL
}

// 获取当前环境信息
export const getCurrentEnv = () => {
  return {
    env,
    ...getApiConfig()
  }
}

export const getSecretKey = () => {
  return getApiConfig().secretKey
}

export const getNimAppKey = () => {
  return getApiConfig().nimAppKey
}

export default API_CONFIG
